﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Framework;

namespace Enterprise.Admin.Handle.Project
{
    public partial class GetListJson : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            var datas = new List<object>();
            var name = Fq("CoName").SafeToString();
            var projectService = new ProjectService();
            var table = projectService.GetTable(page, rows, sort, order, name);
            object result = new { total = table.Total, rows = datas };
            for (int i = 0; i < table.Rows.Count; i++)
            {
                datas.Add(new
                {
                    id = table.Rows[i]["CoProjectId"].SafeToInt(),
                    CoName = table.Rows[i]["CoName"].SafeToString(),
                    CoNameEn = table.Rows[i]["CoNameEn"].SafeToString(),
                    CoSort = table.Rows[i]["CoSort"].SafeToInt(),
                    CoIsDelete = table.Rows[i]["CoIsDelete"].SafeToBool(),
                    CoNormalImage = table.Rows[i]["CoNormalImage"].SafeToString(),
                    CoSmallImage = table.Rows[i]["CoSmallImage"].SafeToString(),
                    CoBigImage = table.Rows[i]["CoBigImage"].SafeToString(),
                    CoDate = table.Rows[i]["CoDate"].SafeToDateTime().ToString("yyyy-MM-dd HH:mm:ss"),
                });
            }
            Json(result);
        }
    }
}